package pers.dawnyang;

import java.time.Duration;
import java.time.LocalTime;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import cn.dev33.satoken.SaManager;
import lombok.extern.log4j.Log4j2;

/**
 * 本地调试-测试环境启动
 * 
 * @author dawn yang 2019年12月13日
 *         上午9:34:19
 *
 */
@Log4j2
@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
public class AdminRunDev extends Application {

  public static void main(String[] args) {
    ready();
    log.info("项目启动中...");
    LocalTime startTime = LocalTime.now();
    SpringApplication app = new SpringApplication(AdminRunDev.class);
    app.setAdditionalProfiles("dev");
    ConfigurableApplicationContext context = app.run(args);
    Environment environment = context.getBean(Environment.class);
    log.info("项目启动成功！");
    log.info("组件个数：" + context.getBeanDefinitionNames().length + "个");
    LocalTime endTime = LocalTime.now();
    log.info("启动耗时：" + (Duration.between(startTime, endTime).getSeconds()) + "秒");
    log.info("启动成功：Sa-Token配置如下：" + SaManager.getConfig());
    log.info("本地访问链接：http://localhost:" + environment.getProperty("server.port")
        + environment.getProperty("server.servlet.context-path"));


  }
}
